home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1994 March
/
CHIP0394.BIN
/
digital
/
kommunik
/
wwwmac
/
machttp.sit
/
MacHTTP 1.3
/
MacHTTP Software
/
Scripts
/
search.script
< prev
next >
Wrap
Text File
|
1994-02-23
|
1KB
|
21 lines
-- This script demonstrates accessing searchable files from MacHTTP.
-- (What it really shows is how to pass arguments to AppleScripts.)
-- http_search_args is a predefined variable that is passed from the server
-- to the script and contains the user-supplied arguments. If the arguments
-- are empty, the script asks the WWW client to prompt for them.
-- If arguments were passed, then the script behaves accordingly.
-- Note: the <ISINDEX> HTML tag is what tells the client the document is searchable
-- and arguments should be collected and passed.
set crlf to (ASCII character 13) & (ASCII character 10)
set http_10_header to "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & ┬
"MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
if http_search_args = "" then
return http_10_header & "<ISINDEX><h2>Please enter the keyword to search for.</h2>"
else if http_search_args = "hello" then
return http_10_header & "<h2>Hello, how are you?</h2>"
else
return http_10_header & "<h2>Sorry, I don't understand '" & ┬
http_search_args & "'. Try 'hello' instead.</h2>"
end if